<template>
  <div class="body vertical center ">
    <div class="sm_top">
      <div :class="`item_list ${curWay.payname === item.payname ? 'active btn_block' : ''}`"
        v-for="(item, index) in legalRecharge" :key="index" @click="chooseWay(item)">
        {{ t(`api_${item.payname}`) }}
      </div>
    </div>
    <div class="sm_content">
      <ImgT :src="`/imgs/payment/sm/sm_${curWay.payname}.webp`" />
    </div>

  </div>
</template>

<script setup lang='ts'>
import { useI18n } from "vue-i18n";
import { ref } from 'vue';
import { Local } from "@/utils/storage";

const { t } = useI18n();
const curWay = ref(Local.get('curExplainWay') || { payname: '' });
const legalRecharge = ref<any>(Local.get('depositWayObj')?.legalRecharge || []);

// 选择充值方式
const chooseWay = (data: any) => {
  Local.set('curExplainWay', data);
  curWay.value = data;
}
</script>

<style lang='scss' scoped>
.body {
  height: calc(100vh - 120px);
  overflow: hidden;
  padding: 10px;
  color: #93b4ff;

  .sm_top {
    padding: 0 15px;
    display: flex;
    flex-wrap: wrap;

    .item_list {
      position: relative;
      display: flex;
      justify-content: center;
      align-items: center;
      border-radius: 10px;
      width: 99px;
      height: 32px;
      padding: 10px;
      margin-bottom: 10px;
      background: url(/imgs/payment/monBg.webp) center no-repeat;
      background-size: 100%;

      &:nth-child(3n+2),
      &:nth-child(3n+3) {
        margin-left: 10px;
      }

      &.active {
        color: #fff;
      }

    }
  }

  .sm_content {
    height: calc(100% - 120px);
    overflow-y: auto;

    img {
      width: 100%;
    }
  }
}
</style>